<?php

class Portlet {

  /**
   * set true to disalbed render
   * @var bool
   */
  protected $_norender =  false;

  /**
   * $var array
   */
  protected $_params;
  /**
   *
   * @var View
   */
  public $view;

  /**
   * @param array $params
   */
  public function __construct($params) {
    $this->_params = $params;
    @$path = array(
//        'layout' => $params['layout'],
        'layout' => 'Admin.layout.index',
        'base_path' => get_class($this),
        'parent_path' => get_parent_class($this)
    );
    $this->view = new View($path);
  }

  /**
   * @param  string $name
   * @param  mixed  $default
   * @return mixed
   */
  public function getParam($name) {
    return @$this->_params[$name];
  }

  /**
   * @param string $name
   * @param mixed $value
   */
  public function setParam($name, $value) {
    $this->_params[$name] = $value;
    return $this;
  }

  /**
   * 
   */
  public function render() {
    if($this->_norender){return '';}
    return $this->view->render();
  }

}